feat: [GH-75] Modification-timestamp marker foo[t1~] for added-at-or-after binding#78
Open
javierlores wants to merge 2 commits into
Open
feat: [GH-75] Modification-timestamp marker foo[t1~] for added-at-or-after binding#78javierlores wants to merge 2 commits into
javierlores wants to merge 2 commits into
Conversation
…r-after binding Add an addition-relative key-bracket binding on flat leaf keys: foo[t1~] binds the key to the values whose ADD occurred in the half-open window [t1, now) -- start-inclusive at t1, end-exclusive at the present moment. This is distinct from the existing forms: foo[t] binds the value present AT the instant regardless of add time, and foo[t1...t2] (GH-74) binds values present DURING an interval regardless of add time. foo[t1~] keys strictly off the add event, so a value added before t1 is excluded even if still present. Motivating use: stale-lock detection (locked[<now-minus-timeout>~] = null). Grammar/AST/parse only; server-side evaluation is a separate concourse change. The canonical toString() renders key[<micros>~], a re-parseable cross-repo contract. - Accept a standalone '~' (SEARCH_MATCH) inside KeyBracketParameter so a detached marker after a quoted/natural-language timestamp is captured; '~' outside brackets is unaffected. - Detect the marker in the centralized Parsing.applyKeyBracket (added by GH-74): trailing '~' -> ModificationKeySymbol; reject the leading added-before form key[~t] (not yet supported); reject a range combined with a marker (key[t1...t2~]). - Add ModificationKeySymbol (sibling to TemporalKeySymbol): rejects navigation and already-parameterized keys, isParameterized() == true so writes and audit/chronicle/diff reject it for free. - Tests: node unit tests, matrix (numeric, quoted/NL, keyword equivalence, before-marker / range-with-marker / double-bracket rejection, round-trip), command accept (select/get/find) and reject (add/audit). - Update CCL_REFERENCE.md section 8.4. Markers on navigation stops and scope prefixes remain out of scope (leaf-only first cut, matching GH-74). Part of the connector data-sync locking initiative; concourse evaluation is cinchapi/concourse#790.
…cket Address code-review findings on the modification-marker work: - Grammar: the SEARCH_MATCH token also lexes the 'search_match'/'contains' keyword spellings, which were silently admitted into KeyBracketParameter content and only failed later at timestamp parsing. Guard the action to admit only the '~' marker and reject the keyword forms with a clear message at parse time. Parser regenerated. - Parsing.applyKeyBracket: use the already-trimmed content uniformly across the marker, single-instant, and range branches (was mixing content and content.trim()). Behavior unchanged. - Tests: testM7 confirms a '~' inside a quoted timestamp is not read as a marker; testM8 confirms a search keyword in a bracket is rejected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #75.
What
Adds an addition-relative key-bracket binding on flat leaf keys:
foo[t1~]binds the key to the values whose add occurred in the half-open window[t1, now)— start-inclusive att1, end-exclusive at the present moment.This is grammar / AST / parse only. Server-side evaluation is a separate concourse change (cinchapi/concourse#790).
Distinct from the existing forms
foo[t]t, regardless of add timefoo[t1...t2](#74)[t1, t2), regardless of add timefoo[t1~](this PR)[t1, now)A value added before
t1is excluded byfoo[t1~]even if it is still present — that's what powers the motivating stale-lock case: a record whose only lock value was added before the cutoff binds to nothing underlocked[<cutoff>~]and is therefore claimable.How
~(SEARCH_MATCH) as a word token insideKeyBracketParameteronly, so a detached marker after a quoted/NL timestamp is captured.~'s meaning outside brackets is unchanged.Parsing.applyKeyBracket(the chokepoint Temporal range key-bracket binding: foo[t1...t2], foo[...t2], foo[t1...] (grammar/AST/parse only) #74 introduced): trailing~→ModificationKeySymbol; leading~t(added-before) → rejected as not-yet-supported; a range combined with a marker (t1...t2~) → rejected.ModificationKeySymbol(new, sibling toTemporalKeySymbol): rejects navigation and already-parameterized keys;isParameterized() == true, so writes andaudit/chronicle/diffreject it for free via the existingrequireNotParameterizedgate. CanonicaltoString()→key[<micros>~](theKeys.parsecross-repo contract).Validation
foo[~t](added-before) → rejected. It's semantically equivalent to an existence-before range; deferred to that sibling work per the ticket.foo[t1...t2~](range + marker) → rejected (a marker binds a single instant).foo[t1~][t2](double bracket) → rejected.Tests
ModificationKeySymbolTest(new): constructor guards, accessor,equals/hashCode, inequality vsTemporalKeySymbolandTemporalRangeKeySymbolwith the same key+ts,toString(), parameter hooks.BracketTimestampMatrixTest(M-series): numeric marker, quoted/NL marker (exercises the detached-~path), keyword equivalence, and the before-marker / range-with-marker / double-bracket rejections, plus round-trip.BracketTimestampCommandTest: accepted onselect/get/find; rejected onaddandaudit.All pass locally (incl.
GrammarTest/JavaCCParserTest/CompilerJavaCCTestregression), parser regenerates cleanly with no new warnings.Scope / follow-ups
a[t1~].b) and scope prefixes — leaf-only first cut, matching Temporal range key-bracket binding: foo[t1...t2], foo[...t2], foo[t1...] (grammar/AST/parse only) #74's boundary. Server-side evaluation.Keys.parsemust re-parse the canonicalkey[<micros>~]form.Part of the connector data-sync locking initiative (cinchapi-server). Sibling grammar work: #74.